<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMessageTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('message', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title')->nullable()->comment('标题');
            $table->enum('type', [1,2])->default(1)->comment('消息类型 1-普通消息 2-图文消息');
            $table->integer('publish_at')->index()->comment('发布时间');
            $table->text('content')->comment('消息类容');
            $table->string('link')->nullable()->comment('消息类容');
            $table->integer('admin_id')->index()->comment('发布人ID');
            $table->enum('receiver_type', [1,2,3])->default(1)->comment('接收者类型 1-用户 2-司机 3-公司管理员');

            $table->timestamps();
            $table->softDeletes();
        });

        \DB::statement("ALTER TABLE `message` comment '消息内容表'");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('message');
    }
}
